package org.example.entity;

import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Arrays;
import java.util.Objects;

@Document("fileInfo")
public class FileInfo {
	private String id;
	private byte[] bytes;
	private String fileName;

	public FileInfo(String id, byte[] bytes, String fileName) {
		this.id = id;
		this.bytes = bytes;
		this.fileName = fileName;
	}

	public FileInfo() {
	}


	@Override
	public String toString() {
		return "FileInfo{" +
				"id='" + id + '\'' +
				", bytes=" + Arrays.toString(bytes) +
				", fileName='" + fileName + '\'' +
				'}';
	}

	@Override
	public boolean equals(Object o) {

		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		FileInfo fileInfo = (FileInfo) o;
		return Objects.equals(id, fileInfo.id) && Arrays.equals(bytes, fileInfo.bytes) && Objects.equals(fileName, fileInfo.fileName);
	}

	@Override
	public int hashCode() {
		int result = Objects.hash(id, fileName);
		result = 31 * result + Arrays.hashCode(bytes);
		return result;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getId() {

		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public byte[] getBytes() {
		return bytes;
	}

	public void setBytes(byte[] bytes) {
		this.bytes = bytes;
	}
}
